//var db = require('../DAOImpl/CommonDb').db;
var currentLat = 31.2051659;
var currentLng = 121.5854;
/*
 * @req.body: driver_id
 * @res send the driver position info 
 * for example: 
 * { 
 * 'statusCode' : '0',
 * 'driverId' : '1', 
 * 'currentLat' : currentLat, 
 * 'currentLng' : currentLng,
 * 'distance' : '200', 
 * 'saveTime' : '2'
 *  };
 */
function getDriverPosition(req, res, next) {
	console.log('getDriverPosition');
	console.log(req.body);
	var result = {
		'statusCode' : '0',
		'driverId' : '1',
		'currentLat' : currentLat,
		'currentLng' : currentLng,
		'distance' : '200',
		'saveTime' : '2'
	};
	currentLat += 0.0001;
	currentLng += 0.0001;
	res.send(result);
	return next();
}

/*
 * @req.body:dirver_id, customer_id
 */
function acceptDriver(req, res, next) {
	console.log('acceptDriver');
	console.log(req.body);
	var result = {
		resultCode : '0',
		driverId : '1',
		currentLat : currentLat,
		currentLng : currentLng,
		distance : '200',
		saveTime : '2'
	};
	res.send(result);
	return next();
}

/*
 * @req.body: cus_id
 */
function cancelRequestDriver(req, res, next) {
	var cus_id = req.body.cus_id;

	res.send({
		'resultCode' : resultCode
	});
	return next;
}

/*
 * @req.body:cus_id, dri_id
 * {'cus_id': '1','dri_id':'2'}
 */
function refuseDriver(req, res, next){
	var result = {'resultCode': 0};
	res.send(result);
	return next;
}

/*
 * @req.body:order_id, result
 * {'order_id': '1', 'result':'5'}
 */
function assessDriver(req, res, next){
	return next;
}
exports.services = [ getDriverPosition, cancelRequestDriver, refuseDriver, 
                     acceptDriver, assessDriver ];